<? 
require_once("admin/classes/check_customer_session.php");
check_customer_session(); 
?>
<?php require_once('include/header.php'); ?>
      <div id="middle_container_for_innerpage">
      <div id="innerpage_top_image"><img src="images/images/innerpage_top_corner_820x5.jpg"  height="5" /></div> 
      <div id="middle_inner_container">
      <?php require_once('include/left_menu.php'); ?>
        
        <div id="inner_page_middle_data">
        	<div id="page_heading">Change Password</div>
          <div id="change_password_form">
          <form action="" method="POST" enctype="multipart/form-data" name="ckpass" id="ckpass">
          	<div id="old_password_text_field">
            	<div id="old_password_text">Enter Your Old Password: </div>
            	<div id="old_password_field"><input type="password" name="password" id="password" style="width:150px;" /></div>
            </div>
            <div id="old_password_text_field">
            	<div id="old_password_text">Enter New Password: </div>
              	<div id="old_password_field"><input type="password" name="new_pass" id="new_pass" style="width:150px;" /></div>
            </div>
            <div id="old_password_text_field">
            	<div id="old_password_text">Confirm New Password: </div>
              	<div id="old_password_field"><input type="password" name="new_pass1" id="new_pass1" onChange="thesame(document.reg.password2.value, document.reg.password1.value);" style="width:150px;"></div>
            </div>
            <div id="old_password_text_field">
            	<div id="button_border" >
                	<input name="modify" type="submit" class="button" id="modify" value="Modify" /></div>
              </div>

			<? require_once("admin/dbconnect.php");
			if($_POST['password'] !=""){
				$pass = $_POST['password'];
				$n_pass = $_POST['new_pass'];
				$cidd = $_SESSION['gbl_email'];
				
				$str="select count(*) from customer where email='$cidd' AND password='$pass'";
				$rc = mysql_query($str) or die ("Sorry! could not execute query $str ".mysql_error());
						$count=mysql_fetch_row($rc);
				
				
						if($count[0]<1)
						{
							echo "<center><b>Invalid Old password try again!</b></center>";
						}
						else{ echo "<b><center>Password Modified Sucessfully</center></b>";
						$upd="UPDATE customer SET password = '$n_pass' where email='$cidd' AND password='$pass'";
				$up_rc = mysql_query($upd) or die ("Sorry! could not execute query $upd ".mysql_error());
						}
				}
				
			?>
            

        </form>
        </div><!-- change password form ends -->
        </div>
        

       
       
      </div> 
      <div id="corner_container_bottom_for_innerpage"><img src="images/images/innerpage_bottom_corner_820x10.jpg"  height="10" /></div>
    </div> 
      <!-- middle_container ends -->
    
    
        
    
<?php require_once('include/footer.php'); ?>
